{include file="layout/header" title="编辑课程" /}
{include file="layout/sidebar" /}
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            课程管理
            <small>编辑课程</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 课程管理</a></li>
            <li class="active">编辑课程</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <script src="__PLUGIN__/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
        <link rel="stylesheet" href="__PLUGIN__/bootstrapvalidator/css/bootstrapValidator.min.css">
        <script src="__PLUGIN__/iCheck/icheck.min.js"></script>
        <link rel="stylesheet" href="__PLUGIN__/iCheck/all.css">
        <!--ueditor-->
        <script src="__ROOT__/ueditor1433/ueditor.config.js" type="text/javascript"></script>
        <script src="__ROOT__/ueditor1433/ueditor.all.min.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8" src="__ROOT__/ueditor1433/lang/zh-cn/zh-cn.js"></script>
        <!-- Horizontal Form -->
        <div class="box box-info" style="width:90%;margin: 0 auto;">
            <div class="box-header with-border">
                <h3 class="box-title">课程参数</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" action="" method="post">
                <div class="box-body">
                    <div class="form-group">
                        <label for="school_id" class="col-sm-2 control-label">校区</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="stu_id" value="{$course.course_id}" />
                            <input type="text" class="form-control" id="school_id" name="school_id" value="{$course.school_id}" placeholder="校区">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="grade" class="col-sm-2 control-label">年级</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="grade" name="grade" value="{$course.grade}" placeholder="年级">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="course_name" class="col-sm-2 control-label">课程名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="course_name" name="course_name" value="{$course.course_name}" placeholder="课程名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="course_number" class="col-sm-2 control-label">课程人数</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="course_number" name="course_number" value="{$course.course_number}" placeholder="课程人数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="teacher" class="col-sm-2 control-label">教师名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="teacher" name="teacher" value="{$course.teacher}" placeholder="教师名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="gender" class="col-sm-2 control-label">性别限制</label>
                        <div class="col-sm-10">
                            <label>
                                <input type="radio" name="gender" value="0" class="minimal" {eq name="$course.gender" value="0"}checked{/eq}> 男
                            </label>
                            <label>
                                <input type="radio" name="gender" value="1" class="minimal" {$course.gender =='1' ? 'checked':''}> 女
                            </label>
                            <label>
                                <input type="radio" name="gender" value="2" class="minimal" {$course.gender =='2' ? 'checked':''}> 不限
                            </label>                           
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="course_place" class="col-sm-2 control-label">上课地点</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="course_place" name="course_place" value="{$course.course_place}" placeholder="上课地点">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="course_date" class="col-sm-2 control-label">上课时间</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="course_date" name="course_date" value="{$course.course_date}" placeholder="上课时间">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="course_info" class="col-sm-2 control-label">课程介绍</label>
                        <div class="col-sm-10">
                            <script id="course_info" name="course_info" type="text/plain">{:htmlspecialchars_decode($course.course_info)}</script>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <input type="hidden" name="__token__" value="{$Request.token}" />
                    <button type="reset" class="btn btn-default">重置</button>
                    <!--<a href="/admin/student/list?page={$page}" class="btn btn-default">返回</a>-->
                    <button type="submit" class="btn btn-info pull-right">提交</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
    //jQuery代码
    $(function () {
        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        //ueditor
        var ue = UE.getEditor('course_info',{
            initialFrameWidth: '100%'
        });

        //bootstrapValidator
        $('form').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                grade: {
                    message: '数据名验证失败',
                    validators: {
                        notEmpty: {
                            message: '年级不能为空'
                        }
                    }
                },
                class: {
                    validators: {
                        notEmpty: {
                            message: '班级不能为空'
                        },
                        digits:{
                            message: '班级必须填数字'
                        }
                    }
                },
                course_name: {
                    validators: {
                        notEmpty: {
                            message: '课程名不能为空'
                        }
                    }
                },
                course_number: {
                    validators: {
                        notEmpty: {
                            message: '课程人数不能为空'
                        },
                        digits:{
                            message: '课程人数必须填数字'
                        }
                    }
                },
                teacher: {
                    validators: {
                        notEmpty: {
                            message: '教师名不能为空'
                        }
                    }
                },
                course_place: {
                    validators: {
                        notEmpty: {
                            message: '上课地点不能为空'
                        }
                    }
                },
                course_date: {
                    validators: {
                        notEmpty: {
                            message: '上课时间不能为空'
                        }
                    }
                }
            }
        });
    });
</script>
{include file="layout/footer" /}